home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / k3bfilesplitter.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-05-27  |  2.3 KB  |  109 lines

  1. /* 
  2.  *
  3.  * $Id: sourceheader 511311 2006-02-19 14:51:05Z trueg $
  4.  * Copyright (C) 2006 Sebastian Trueg <trueg@k3b.org>
  5.  *
  6.  * This file is part of the K3b project.
  7.  * Copyright (C) 1998-2007 Sebastian Trueg <trueg@k3b.org>
  8.  *
  9.  * This program is free software; you can redistribute it and/or modify
  10.  * it under the terms of the GNU General Public License as published by
  11.  * the Free Software Foundation; either version 2 of the License, or
  12.  * (at your option) any later version.
  13.  * See the file "COPYING" for the exact licensing terms.
  14.  */
  15.  
  16. #ifndef _K3B_FILE_SPLITTER_H_
  17. #define _K3B_FILE_SPLITTER_H_
  18.  
  19. #include <qiodevice.h>
  20. #include <qstring.h>
  21.  
  22. #include <kio/global.h>
  23.  
  24. #include <k3b_export.h>
  25.  
  26.  
  27. /**
  28.  * QFile replacement which splits
  29.  * big files according to the underlying file system's
  30.  * maximum file size.
  31.  *
  32.  * The filename will be changed to include a counter
  33.  * if the file has to be splitted like so:
  34.  *
  35.  * <pre>
  36.  * filename.iso
  37.  * filename.iso.001
  38.  * filename.iso.002
  39.  * ...
  40.  * </pre>
  41.  */
  42. class LIBK3B_EXPORT K3bFileSplitter : public QIODevice
  43. {
  44.  public:
  45.   K3bFileSplitter();
  46.   K3bFileSplitter( const QString& filename );
  47.   ~K3bFileSplitter();
  48.  
  49.   /**
  50.    * Set the maximum file size. If this is set to 0
  51.    * (the default) the max filesize is determined based on 
  52.    * the filesystem type.
  53.    *
  54.    * Be aware that setName will reset the max file size.
  55.    */
  56.   void setMaxFileSize( KIO::filesize_t size );
  57.  
  58.   const QString& name() const;
  59.  
  60.   void setName( const QString& filename );
  61.  
  62.   virtual bool open( int mode );
  63.  
  64.   virtual void close();
  65.  
  66.   /**
  67.    * File descriptor to read from and write to.
  68.    * Not implemented yet!
  69.    */
  70.   int handle() const;
  71.  
  72.   virtual void flush();
  73.  
  74.   /**
  75.    * Not implemented
  76.    */
  77.   virtual Offset size() const;
  78.  
  79.   /**
  80.    * Not implemented
  81.    */
  82.   virtual Offset at() const;
  83.  
  84.   /**
  85.    * Not implemented
  86.    */
  87.   virtual bool at( Offset );
  88.  
  89.   virtual bool atEnd() const;
  90.   virtual Q_LONG readBlock( char *data, Q_ULONG maxlen );
  91.   virtual Q_LONG writeBlock( const char *data, Q_ULONG len );
  92.   virtual int getch();
  93.   virtual int putch( int );
  94.   virtual int ungetch( int );
  95.  
  96.   /**
  97.    * Deletes all the splitted files.
  98.    * Caution: Does remove all files that fit the naming scheme without any 
  99.    * additional checks.
  100.    */
  101.   void remove();
  102.  
  103.  private:
  104.   class Private;
  105.   Private* d;
  106. };
  107.  
  108. #endif
  109.